//
// Created by licks on 24-8-22.
//

#include <iostream>
#include <csignal>
#include <cstring>
#include "../serial_port.h"

int main(int arg, char **argv)
{
    CSerialPort serial_port;
    serial_port.open("/dev/ttyUSB1");
    if (serial_port.is_open())
    {
        std::cout << "open success" << std::endl;
    }
    char buffer[2048] = {0};
    while (true)
    {
        memset(buffer, 0, sizeof(buffer));
        serial_port.receive(buffer, sizeof(buffer));
        std::cout << "receive: " << buffer << std::endl;
        usleep(500);
    }
    return 0;
}